<template>
  <footer class="footer">
    <span class="todo-count"
      >剩余<strong>{{ arr.length }}</strong></span
    >
    <ul class="filters">
      <li>
        <a
          :class="{ selected: isH === 'all' }"
          href="javascript:;"
          @click="changeFn('all')"
          >全部</a
        >
      </li>
      <li>
        <a
          :class="{ selected: isH === 'no' }"
          href="javascript:;"
          @click="changeFn('no')"
          >未完成</a
        >
      </li>
      <li>
        <a
          :class="{ selected: isH === 'yes' }"
          href="javascript:;"
          @click="changeFn('yes')"
          >已完成</a
        >
      </li>
    </ul>
    <button class="clear-completed" @click="clearFn">清除已完成</button>
  </footer>
</template>
 
<script>
// 分别判断(高亮值 -> 本应该对应的值 === 判断)
export default {
  data() {
    return {
      isH: "all",
    };
  },
  methods: {
    changeFn(theStr) {
      this.isH = theStr
      this.$emit("changeEvent", theStr)
    },
    // 清空已完成
    clearFn(){
      this.$emit("clearEvent")
    }
  },
  props: ["arr"],
};
</script>